﻿#region << 文 件 说 明 >>

/*----------------------------------------------------------------
// 文件名称：IDialogMessage
// 创 建 者：杨程
// 创建时间：2021/10/18 10:51:43
// 文件版本：V1.0.0
// ===============================================================
// 功能描述：
//
//
//----------------------------------------------------------------*/

#endregion

namespace Vampirewal.Core.Components;

internal sealed class VampirewalCoreMdiViewService : IVampirewalCoreMdiViewService
{
    public VampirewalCoreMdiViewService()
    {
        MdiViews=new ObservableCollection<IMdiChildViewBase>();
    }

    public ObservableCollection<IMdiChildViewBase> MdiViews { get; private set; }

    /// <summary>
    /// 创建Mdi子窗体
    /// </summary>
    /// <param name="setting"></param>
    /// <returns></returns>
    /// <exception cref="ArgumentNullException"></exception>
    public void CreateMdiChildView(Action<MdiChildViewSetting> setting)
    {
        if(setting == null)
            throw new ArgumentNullException(nameof(setting));

        MdiChildViewSetting set = new MdiChildViewSetting();

        setting.Invoke(set);

        //var view = VampirewalCoreContext.GetInstance().GetView<IMdiChildViewBase>(set.vi);
        set.MdiView.Setting(set);

        MdiViews.Add(set.MdiView);

    }
}